{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static "booktahoe/month.css" %}" />
{% if user.username %}
<p> Welcome {{user.username}} <a href = "/logout/" > Logout </a>  <a href = "/userUpdate/" > Update user info </a> </p>
{% else %}
<a href = "{% url "django.contrib.auth.views.login" %}" > Login </a></br>
{% endif %}

<a href= "{% url "booktahoe.views.newMonth" year month "prev" %}">&lt;&lt; Prev</a>
<a href= "{% url "booktahoe.views.newMonth" year month "next" %}">Next &gt;&gt;</a>
<h4>{{ mname }} {{ year }}</h4>

<div class="month">
    <table>

    <tr>
    	<td class="datenum">Sun</td>
        <td class="datenum">Mon</td>
        <td class="datenum">Tue</td>
        <td class="datenum">Wed</td>
        <td class="datenum">Thu</td>
        <td class="datenum">Fri</td>
        <td class="datenum">Sat</td>
    </tr>

    {% for week in month_days %}
        <tr>
        {% for day, entries, current, guests, parking in week %}

            <!-- TD style: empty | day | current; onClick handler and highlight  -->
            <td class= {% if day == 0 %}"empty"{% endif %}
            {% if day != 0 and not current %}"day"{% endif %}
            {% if day != 0 and current %}"current"{% endif %}
            {% if day != 0 %}
            onClick="parent.location='{% url  "booktahoe.views.detail" year month day %}'" >
                <div class="datenum"> {{ day }} </div>
                {% for entry in entries %}
                	{% if entry.attendees.count > 0 or entry.comment_set.count > 0 %}
                    <div title = "{% for a in entry.attendees.all %}{{a.username}}&#10{% endfor %}">
					{{ entry.attendees.count }} members </div>
                    {{ guests }} guests
                    <br />
                    {{ parking }} cars
                    <br />
                    {{ entry.comment_set.count }} comments
               		{% endif %}
                {% endfor %}
            {% else %}
            >
            <p> </p>
            {% endif %}
            </td>
        {% endfor %}
        </tr>
    {% endfor %}
    </table>

    <div class="clear"></div>
</div>